package exercise;

/**
 * @ClassName Rect
 * @Deacription TODO
 * @Author 谢忠辉
 * @Date 2021/3/16 0016 11:19
 **/
public class Rect {
    //矩形的宽
    protected double width ;
    //矩形的高
    protected double height;

    public Rect(){
       this.width = 10 ;
       this.height = 10 ;
    }


    public Rect( double width, double height){
        this.width = width ;
        this.height = height ;
    }

    /**
     * 矩形的面积函数
     */
    public void area(){
        System.out.println("面积：" + width*height);
    }

    /**
     * 矩形的周长函数
     */
    public void perimeter(){
        System.out.println("周长：" + (width+height)*2);
    }

    public void show(){
        area();
        perimeter();
    }

}
